/*
 *Author:Jackong
 *Date:2012/07/04
 */
#include "StdAfx.h"
#include "handler.h"

namespace fly {

	namespace jld{

		namespace server {	

			handler::handler()
				:handler_(NULL)
				,target_(T_SELF)
			{
			}


			handler::~handler()
			{
				LOG_DEBUG("Delete handler");
				delete handler_;
			}
			handler* handler::set_next(handler* hnd)
			{
				return handler_ = hnd;
			}
			bool handler::handle_recv(recv_buf& recv_buf, send_buf& send_buf, conn_info& conn_info)
			{
				if (NULL != handler_)
				{
					return handler_->handle_recv(recv_buf, send_buf, conn_info);
				}
				LOG_EMER("Out of control of all handlers");
				return false;
			}

		}
	}
}